package cl.whyem.testsutilityproject.guava.functions;

import cl.whyem.testsutilityproject.guava.dto.BaseDTO;
import com.google.common.base.Function;

/**
 * Suma el campo 'monto' del objeto BaseDTO y lo retorna el total
 * 
 * @author ymedina
 */
public class Reduce implements Function<BaseDTO, Integer> {

    private Integer total;

    public Reduce() {
        total = 0;
    }

    @Override
    public Integer apply(BaseDTO f) {
        total += f.getMonto();
        return total;
    }
}